/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Daniel Cruz
 */
@Entity
@Table(name = "b_persona")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BPersona.findAll", query = "SELECT b FROM BPersona b"),
    @NamedQuery(name = "BPersona.findByPrsIdentificacion", query = "SELECT b FROM BPersona b WHERE b.prsIdentificacion = :prsIdentificacion"),
    @NamedQuery(name = "BPersona.findByPrsPrimerApellido", query = "SELECT b FROM BPersona b WHERE b.prsPrimerApellido = :prsPrimerApellido"),
    @NamedQuery(name = "BPersona.findByPrsSegundoApellido", query = "SELECT b FROM BPersona b WHERE b.prsSegundoApellido = :prsSegundoApellido"),
    @NamedQuery(name = "BPersona.findByPrsPrimerNombre", query = "SELECT b FROM BPersona b WHERE b.prsPrimerNombre = :prsPrimerNombre"),
    @NamedQuery(name = "BPersona.findByPrsSegundoNombre", query = "SELECT b FROM BPersona b WHERE b.prsSegundoNombre = :prsSegundoNombre"),
    @NamedQuery(name = "BPersona.findByPrsSexo", query = "SELECT b FROM BPersona b WHERE b.prsSexo = :prsSexo"),
    @NamedQuery(name = "BPersona.findByPrsFechaNacimiento", query = "SELECT b FROM BPersona b WHERE b.prsFechaNacimiento = :prsFechaNacimiento"),
    @NamedQuery(name = "BPersona.findByPrsDireccion", query = "SELECT b FROM BPersona b WHERE b.prsDireccion = :prsDireccion"),
    @NamedQuery(name = "BPersona.findByPrsMail", query = "SELECT b FROM BPersona b WHERE b.prsMail = :prsMail"),
    @NamedQuery(name = "BPersona.findByPrsEstado", query = "SELECT b FROM BPersona b WHERE b.prsEstado = :prsEstado")})
public class BPersona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "prs_identificacion")
    private String prsIdentificacion;
    @Size(max = 50)
    @Column(name = "prs_primer_apellido")
    private String prsPrimerApellido;
    @Size(max = 50)
    @Column(name = "prs_segundo_apellido")
    private String prsSegundoApellido;
    @Size(max = 50)
    @Column(name = "prs_primer_nombre")
    private String prsPrimerNombre;
    @Size(max = 50)
    @Column(name = "prs_segundo_nombre")
    private String prsSegundoNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "prs_sexo")
    private String prsSexo;
    @Column(name = "prs_fecha_nacimiento")
    @Temporal(TemporalType.DATE)
    private Date prsFechaNacimiento;
    @Size(max = 500)
    @Column(name = "prs_direccion")
    private String prsDireccion;
    @Size(max = 150)
    @Column(name = "prs_mail")
    private String prsMail;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "prs_estado")
    private String prsEstado;
    @JoinColumn(name = "prs_bat_tipo_doc", referencedColumnName = "bat_id")
    @ManyToOne(optional = false)
    private BBasicaTipo prsBatTipoDoc;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "prsIdentificacion")
    private Collection<BLogin> bLoginCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "prsIdentificacion")
    private Collection<BEmpleado> bEmpleadoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bPersona")
    private Collection<Reserva> reservaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bPersona")
    private Collection<TelefonoPersona> telefonoPersonaCollection;

    public BPersona() {
    }

    public BPersona(String prsIdentificacion) {
        this.prsIdentificacion = prsIdentificacion;
    }

    public BPersona(String prsIdentificacion, String prsSexo, String prsEstado) {
        this.prsIdentificacion = prsIdentificacion;
        this.prsSexo = prsSexo;
        this.prsEstado = prsEstado;
    }

    public String getPrsIdentificacion() {
        return prsIdentificacion;
    }

    public void setPrsIdentificacion(String prsIdentificacion) {
        this.prsIdentificacion = prsIdentificacion;
    }

    public String getPrsPrimerApellido() {
        return prsPrimerApellido;
    }

    public void setPrsPrimerApellido(String prsPrimerApellido) {
        this.prsPrimerApellido = prsPrimerApellido;
    }

    public String getPrsSegundoApellido() {
        return prsSegundoApellido;
    }

    public void setPrsSegundoApellido(String prsSegundoApellido) {
        this.prsSegundoApellido = prsSegundoApellido;
    }

    public String getPrsPrimerNombre() {
        return prsPrimerNombre;
    }

    public void setPrsPrimerNombre(String prsPrimerNombre) {
        this.prsPrimerNombre = prsPrimerNombre;
    }

    public String getPrsSegundoNombre() {
        return prsSegundoNombre;
    }

    public void setPrsSegundoNombre(String prsSegundoNombre) {
        this.prsSegundoNombre = prsSegundoNombre;
    }

    public String getPrsSexo() {
        return prsSexo;
    }

    public void setPrsSexo(String prsSexo) {
        this.prsSexo = prsSexo;
    }

    public Date getPrsFechaNacimiento() {
        return prsFechaNacimiento;
    }

    public void setPrsFechaNacimiento(Date prsFechaNacimiento) {
        this.prsFechaNacimiento = prsFechaNacimiento;
    }

    public String getPrsDireccion() {
        return prsDireccion;
    }

    public void setPrsDireccion(String prsDireccion) {
        this.prsDireccion = prsDireccion;
    }

    public String getPrsMail() {
        return prsMail;
    }

    public void setPrsMail(String prsMail) {
        this.prsMail = prsMail;
    }

    public String getPrsEstado() {
        return prsEstado;
    }

    public void setPrsEstado(String prsEstado) {
        this.prsEstado = prsEstado;
    }

    public BBasicaTipo getPrsBatTipoDoc() {
        return prsBatTipoDoc;
    }

    public void setPrsBatTipoDoc(BBasicaTipo prsBatTipoDoc) {
        this.prsBatTipoDoc = prsBatTipoDoc;
    }

    @XmlTransient
    public Collection<BLogin> getBLoginCollection() {
        return bLoginCollection;
    }

    public void setBLoginCollection(Collection<BLogin> bLoginCollection) {
        this.bLoginCollection = bLoginCollection;
    }

    @XmlTransient
    public Collection<BEmpleado> getBEmpleadoCollection() {
        return bEmpleadoCollection;
    }

    public void setBEmpleadoCollection(Collection<BEmpleado> bEmpleadoCollection) {
        this.bEmpleadoCollection = bEmpleadoCollection;
    }

    @XmlTransient
    public Collection<Reserva> getReservaCollection() {
        return reservaCollection;
    }

    public void setReservaCollection(Collection<Reserva> reservaCollection) {
        this.reservaCollection = reservaCollection;
    }

    @XmlTransient
    public Collection<TelefonoPersona> getTelefonoPersonaCollection() {
        return telefonoPersonaCollection;
    }

    public void setTelefonoPersonaCollection(Collection<TelefonoPersona> telefonoPersonaCollection) {
        this.telefonoPersonaCollection = telefonoPersonaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (prsIdentificacion != null ? prsIdentificacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BPersona)) {
            return false;
        }
        BPersona other = (BPersona) object;
        if ((this.prsIdentificacion == null && other.prsIdentificacion != null) || (this.prsIdentificacion != null && !this.prsIdentificacion.equals(other.prsIdentificacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.BPersona[ prsIdentificacion=" + prsIdentificacion + " ]";
    }
    
}
